//
//  SecurityViewController.m
//  TenThousand
//
//  Created by 我的 on 16/6/20.
//  Copyright © 2016年 baixue. All rights reserved.
//

#import "SecurityViewController.h"

#import "LawGuaranteeViewController.h"//法律保障Controller
#import "RiskGuaranteeViewController.h"//风控保障Controller
#import "ChannelGuaranteeViewController.h"//渠道保障Controller
#import "FundGuaranteeViewController.h"//资金保障Controller

@interface SecurityViewController ()<GUITabPagerDataSource, GUITabPagerDelegate>


@end
#define subController @[@"InformationViewController",@"InvestmentVC",@"RepaymentscheduleViewController"]
#define TITLE @[@"法律保障",@"风控保障",@"渠道保障",@"资金保障"]
@implementation SecurityViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    [self setDataSource:self];
    [self setDelegate:self];
    self.navigationItem.title = @"安全保障";
    [self createLeft:[UIImage imageNamed:@"ZHSZicon_03"] leftClick:^{
        [self.navigationController popViewControllerAnimated:YES];
    } right:nil rightClick:nil];
    
    self.view.backgroundColor = [UIColor colorWithRed:237/255.0 green:237/255.0 blue:237/255.0 alpha:1];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self reloadData];
}

#pragma mark - Tab Pager Data Source

- (NSInteger)numberOfViewControllers {
    return 4;
}

- (UIViewController *)viewControllerForIndex:(NSInteger)index {
    if (index == 0) {
        LawGuaranteeViewController *law = [[LawGuaranteeViewController alloc] init];
        return law;
    }else if (index == 1){
        RiskGuaranteeViewController *risk = [[RiskGuaranteeViewController alloc] init];
        return risk;
    }else if (index == 2){
        ChannelGuaranteeViewController *channel = [[ChannelGuaranteeViewController alloc] init];
        return channel;
    }else{
        FundGuaranteeViewController *fund= [[FundGuaranteeViewController alloc] init];
        return fund;
    }
}



- (NSString *)titleForTabAtIndex:(NSInteger)index {
    return TITLE[index];
}

- (CGFloat)tabHeight {
    
    return 35.0f;
}

- (UIColor *)tabColor {
    // Default: [UIColor orangeColor];
    return [UIColor colorWithRed:0.93 green:0.35 blue:0.29 alpha:1.00];
}

- (UIColor *)tabBackgroundColor {
    // Default: [UIColor colorWithWhite:0.95f alpha:1.0f];
    return [UIColor lightTextColor];
}

- (UIFont *)titleFont {
    
    return [UIFont systemFontOfSize:13.0f];
}

- (UIColor *)titleColor {
    // Default: [UIColor blackColor];
    return [UIColor blackColor];
}

#pragma mark - Tab Pager Delegate

- (void)tabPager:(GUITabPagerViewController *)tabPager willTransitionToTabAtIndex:(NSInteger)index {
    NSLog(@"Will transition from tab %ld to %ld", [self selectedIndex], (long)index);
    NSInteger selectIndex = [self selectedIndex];
    UILabel *selectLable = [self tabViews] [selectIndex];
    selectLable.textColor = [UIColor blackColor];

}

- (void)tabPager:(GUITabPagerViewController *)tabPager didTransitionToTabAtIndex:(NSInteger)index {
    NSLog(@"Did transition to tab %ld", (long)index);
    UILabel *lable = [self tabViews][index];
    lable.textColor = [UIColor colorWithRed:0.93 green:0.35 blue:0.29 alpha:1.00];
}








@end
